import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description: 对数组进行排序 技术在前 偶数在后
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2023-08-02  15:51
 */
public class Test3 {
    public static void main(String[] args) {
        int[] array = {1,2,3,4,5};
        find(array);
        System.out.println(Arrays.toString(array));
    }

    public static int[] find(int[] array) {
        int left = 0;
        int right = array.length-1;
        while(left < right) {
            while (array[left] % 2 != 0) {
                left++;
            }
            while (array[right] % 2 == 0) {
                right--;
            }
            if(left < right) {
                int tmp = array[left];
                array[left] = array[right];
                array[right] = tmp;
            }
        }
        return array;
    }
}
